package com.wmh.baseservice.admin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * @author mmx generator
 * @since 2021-11-05
 */
@ApiModel(value = "AdInfo对象", description = "管理员-用户信息")
@Data
@Accessors(chain = true)
public class AdInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "状态")
    private String remark;

    @ApiModelProperty(value = "-1: 冻结   1: 正常   ")
    private Integer status;

    @ApiModelProperty(value = "登录时间")
    private Date loginTime;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "版本")
    @Version
    private Integer version;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "头像")
    private String avatar;

    @ApiModelProperty(value = "账号名")
    private String account;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "盐值")
    private String salt;

    @ApiModelProperty(value = "管理员邮箱")
    private String email;

    @TableLogic
    private Integer deleted;


    public static final String ID = "id";

    public static final String REMARK = "remark";

    public static final String STATUS = "status";

    public static final String LOGIN_TIME = "login_time";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

    public static final String VERSION = "version";

    public static final String NAME = "name";

    public static final String AVATAR = "avatar";

    public static final String ACCOUNT = "account";

    public static final String PASSWORD = "password";

    public static final String SALT = "salt";

    public static final String DELETED = "deleted";

    public static final String Email = "email";


    public final static String[] getFields(String... noField) {
        List<String> list = new ArrayList<>(Arrays.asList(
                AdInfo.ID
                , AdInfo.REMARK
                , AdInfo.STATUS
                , AdInfo.LOGIN_TIME
                , AdInfo.CREATE_TIME
                , AdInfo.UPDATE_TIME
                , AdInfo.VERSION
                , AdInfo.NAME
                , AdInfo.AVATAR
                , AdInfo.ACCOUNT
                , AdInfo.PASSWORD
                , AdInfo.SALT
                , AdInfo.DELETED
                , AdInfo.Email
        ));
        list.removeAll(new ArrayList<>(Arrays.asList(noField)));
        return list.toArray(new String[0]);
    }
}